import axiosInstance from '@/tools/request'
import type { SysPermission } from '@/api/sysPermission/sysPermission.d' // 这里时你将 sys_permission.d.ts 存放的位置

//sysPermissionAdd 系统权限添加
export const sysPermissionAdd = (sysPermission: SysPermission) => {
  return axiosInstance({
    url: `/sysPermission`,
    method: 'post',
    data: sysPermission
  })
}

//sysPermissionRemove 系统权限删除
export const sysPermissionRemove = (sysPermissionId: number) => {
  return axiosInstance({
    url: `/sysPermission/${sysPermissionId}`,
    method: 'delete'
  })
}

//sysPermissionModify 系统权限修改
export const sysPermissionModify = (sysPermission: SysPermission) => {
  return axiosInstance({
    url: `/sysPermission`,
    method: 'put',
    data: sysPermission
  })
}

//sysPermissionList 系统权限列表
export const sysPermissionList = (sysPermission: SysPermission, params: any) => {
  return axiosInstance({
    url: '/sysPermission/list',
    method: 'post',
    params: params,
    data: sysPermission
  })
}

//sysPermissionById 系统权限查询通过ID
export const sysPermissionById = (sysPermissionId: number) => {
  return axiosInstance({
    url: `/sysPermission/${sysPermissionId}`,
    method: 'get'
  })
}

//sysPermissionRemoveBatch 系统权限删除系统缓存
export const sysPermissionRemoveBatch = (ids: any[]) => {
  return axiosInstance({
    url: `/sysPermission/batchDelete`,
    method: 'delete',
    params: {
      ids: ids
    }
  })
}
